<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="一份耕耘，一份收获">
    <meta name="keyword"  content="朗月清风,韩亚军">
    <link rel="shortcut icon" href="/img/favicon.ico">
    <!-- Place this tag in your head or just before your close body tag. -->
    <script async defer src="https://buttons.github.io/buttons.js"></script>
    <title>
        
          github上Go项目使用Travis CI和Docker Hub实现持续集成 - 朗月清风
        
    </title>

    <link rel="canonical" href="https://hanyajun.com/article/github_travis_ci/">

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <!-- Custom CSS --> 
    <link rel="stylesheet" href="/css/beantech.min.css">

    <link rel="stylesheet" href="/css/donate.css">
    
    <!-- Pygments Highlight CSS -->
    <link rel="stylesheet" href="/css/highlight.css">

    <link rel="stylesheet" href="/css/widget.css">

    <link rel="stylesheet" href="/css/rocket.css">

    <link rel="stylesheet" href="/css/signature.css">

    <link rel="stylesheet" href="/css/toc.css">

    <!-- Custom Fonts -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
    <!-- Hux change font-awesome CDN to qiniu -->
    <link href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- Hux Delete, sad but pending in China
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/
    css'>
    -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- ga & ba script hoook -->
    <script></script>

    <!--不蒜子-->
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

    
<link rel="stylesheet" href="\assets\css\APlayer.min.css" class="aplayer-style-marker">
<script src="\assets\js\APlayer.min.js" class="aplayer-script-marker"></script>
<script src="\assets\js\Meting.min.js" class="meting-script-marker"></script>
</head>


<!-- hack iOS CSS :active style -->
<body ontouchstart="">
	<!-- Modified by Yu-Hsuan Yen -->
<!-- Post Header -->
<style type="text/css">
    header.intro-header{
        
            background-image: url('http://cdn.hanyajun.com/20190516_014950_168942.jpg')
            /*post*/
        
    }
    
</style>

<header class="intro-header" >
    <!-- Signature -->
    <div id="signature">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                
                    <div class="post-heading">
                        <div class="tags">
                            
                              <a class="tag" href="/tags/#devops" title="devops">devops</a>
                            
                        </div>
                        <h1>github上Go项目使用Travis CI和Docker Hub实现持续集成</h1>
                        <h2 class="subheading">使用Travis CI和Docker Hub实现持续集成</h2>

                        <!--文章访问量统计-->
                        
                            <span id="busuanzi_container_page_pv">本文已被阅读过<span id="busuanzi_value_page_pv"></span>次</span>
                        
                        <!--文章访问量统计-->

                        <span class="meta">
                            Posted by 韩亚军 on
                            2019-05-16
                        </span>
                    </div>
                


                </div>
            </div>
        </div>
    </div>
</header>

	
    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">韩亚军</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <!-- Known Issue, found by Hux:
            <nav>'s height woule be hold on by its content.
            so, when navbar scale out, the <nav> will cover tags.
            also mask any touch event of tags, unfortunately.
        -->
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/">Home</a>
                    </li>

                    
                        <li>
                            <a href="/about/" >About</a>
                        </li>
                    
                        <li>
                            <a href="/archives/" >Archives</a>
                        </li>
                    
                        <li>
                            <a href="/tags/" >Tags</a>
                        </li>
                    

                    <!-- 

                        
                    

                        
                        <li>
                            <a href="/about/">About</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/tags/">Tags</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/archive/">Archives</a>
                        </li>
                        
                     -->
                    
                </ul>
            </div>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<script>
    // Drop Bootstarp low-performance Navbar
    // Use customize navbar with high-quality material design animation
    // in high-perf jank-free CSS3 implementation
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        // CLOSE
            $navbar.className = " ";
            // wait until animation end.
            setTimeout(function(){
                // prevent frequently toggle
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        // OPEN
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>


    <!-- Main Content -->
    <!-- Modify by Yu-Hsuan Yen -->

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

            <!-- Post Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                <p><img src="http://cdn.hanyajun.com/20190515_235500_go_travers_ci.png" alt=""></p>
<h3 id="介绍">介绍</h3>
<p>在本文中，我们将介绍如何使用Github，Travis-CI和Docker Hub创建一个简单的持续集成过程。</p>
<h3 id="项目">项目</h3>
<p>这次使用的一个项目是自己写的一个爬虫小程序(<a href="https://github.com/Han-Ya-Jun/news_watch_notice" target="_blank" rel="noopener">https://github.com/Han-Ya-Jun/news_watch_notice</a>)</p>
<h4 id="项目目录">项目目录</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">news_watch_notice</span><br><span class="line">├── cmd    //main</span><br><span class="line">├── conf</span><br><span class="line">├── dis</span><br><span class="line">├── Dockerfile</span><br><span class="line">├── Makefile</span><br><span class="line">├── pkg</span><br><span class="line">├── qrcode</span><br><span class="line">├── .travis.yml</span><br><span class="line">├── README.md</span><br><span class="line">├── vendor</span><br><span class="line">├── utils</span><br></pre></td></tr></table></figure>
<h4 id="dockerfile">Dockerfile</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">FROM alpine:3.6</span><br><span class="line"></span><br><span class="line">MAINTAINER hanyajun0123@gmail.com</span><br><span class="line">RUN apk update &amp;&amp; apk add curl bash tree tzdata \</span><br><span class="line">    &amp;&amp; cp -r -f /usr/share/zoneinfo/Hongkong /etc/localtime</span><br><span class="line">ADD news_watch_notice /usr/bin/</span><br><span class="line">ADD news_watch_notice.sha /usr/bin/</span><br><span class="line">CMD [&quot;news_watch_notice&quot;]</span><br></pre></td></tr></table></figure>
<h4 id="makefile">makefile</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">TARGET=news_watch_notice</span><br><span class="line">PKG=$(TARGET)</span><br><span class="line">TAG=latest</span><br><span class="line">IMAGE_PREFIX?=hanyajun</span><br><span class="line">IMAGE_PREFIX_PRD=hanyajun</span><br><span class="line">TARGET_IMAGE_DEV=$(IMAGE_PREFIX)/$(TARGET):$(TAG)</span><br><span class="line">TARGET_IMAGE_PRD=$(IMAGE_PREFIX_PRD)/$(TARGET):$(TAG)</span><br><span class="line">all: image</span><br><span class="line"></span><br><span class="line">$(TARGET):</span><br><span class="line">	CGO_ENABLED=0 go build -o dist/$(TARGET) $(PKG)/cmd</span><br><span class="line"></span><br><span class="line">gitlog:</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">target:</span><br><span class="line">	mkdir -p dist</span><br><span class="line">	git log | head -n 1 &gt; dist/news_watch_notice.sha</span><br><span class="line">	docker run --rm -i -v `pwd`:/go/src/$(PKG) \</span><br><span class="line">	  -w /go/src/$(PKG) golang:1.11.5 \</span><br><span class="line">	  make $(TARGET)</span><br><span class="line"></span><br><span class="line">image-dev: target</span><br><span class="line">	cd dist &amp;&amp; cp ../Dockerfile ./ &amp;&amp; \</span><br><span class="line">	docker build -t $(TARGET_IMAGE_DEV) .</span><br><span class="line"></span><br><span class="line">push-dev:</span><br><span class="line">	docker push $(TARGET_IMAGE_DEV)</span><br><span class="line"></span><br><span class="line">image-prd: target</span><br><span class="line">	cd dist &amp;&amp; cp ../Dockerfile ./ &amp;&amp; \</span><br><span class="line">	docker build -t $(TARGET_IMAGE_PRD) .</span><br><span class="line"></span><br><span class="line">push-prd:</span><br><span class="line">	docker push $(TARGET_IMAGE_PRD)</span><br><span class="line">clean:</span><br><span class="line">	rm -rf dist</span><br><span class="line"></span><br><span class="line">.PHONY: image target clean push $(TARGET)</span><br></pre></td></tr></table></figure>
<h4 id="travisyml">.travis.yml</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">language: go</span><br><span class="line">go:          # 语言版本号</span><br><span class="line">  - &quot;1.11.5&quot;   # 默认使用最新版本,注意，需要 &quot;1.10&quot; 版本的时候必须表示为字符串形式，如果写成 1.10 则会使用 1.1 版本;x表示对应前缀的最新版本</span><br><span class="line">services:</span><br><span class="line">  - docker  #需要的docker环境</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">install:</span><br><span class="line">  - make image-dev  #build</span><br><span class="line"></span><br><span class="line">script:</span><br><span class="line">  - echo &quot;$DOCKER_PASSWORD&quot; | docker login -u &quot;$DOCKER_USERNAME&quot; --password-stdin</span><br><span class="line">  - make push-dev  # push</span><br></pre></td></tr></table></figure>
<h3 id="travis的配置httpstravis-ciorg">travis的配置(<a href="https://travis-ci.org" target="_blank" rel="noopener">https://travis-ci.org</a>)</h3>
<h4 id="打开项目ci开关">打开项目ci开关</h4>
<p><img src="http://cdn.hanyajun.com/20190516_003323_travis_ci1.png" alt=""></p>
<h4 id="设置docker-hub的用户和密码环境变量push需要登录认证">设置docker hub的用户和密码环境变量（push需要登录认证）</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">DOCKER_PASSWORD</span><br><span class="line"></span><br><span class="line">DOCKER_USERNAME</span><br></pre></td></tr></table></figure>
<p><img src="http://cdn.hanyajun.com/20190516_003732_docker_user.png" alt=""></p>
<h3 id="提交项目代码触发ci">提交项目代码触发ci</h3>
<p><img src="http://cdn.hanyajun.com/20190516_004430_ci_success.png" alt=""></p>
<h4 id="部分ci日志">部分ci日志</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br></pre></td><td class="code"><pre><span class="line">docker_mtu</span><br><span class="line">docker stop/waiting</span><br><span class="line">docker start/running, process 3638</span><br><span class="line">services</span><br><span class="line">0.02s$ sudo service docker start</span><br><span class="line">start: Job is already running: docker</span><br><span class="line">Updating gimme</span><br><span class="line">git.checkout</span><br><span class="line">0.85s$ git clone --depth=50 --branch=master https://github.com/Han-Ya-Jun/news_watch_notice.git Han-Ya-Jun/news_watch_notice</span><br><span class="line">Cloning into &apos;Han-Ya-Jun/news_watch_notice&apos;...</span><br><span class="line">$ cd Han-Ya-Jun/news_watch_notice</span><br><span class="line">$ git checkout -qf e05633a1c6e0c3289c85aedf28461b718fe1af13</span><br><span class="line">$ travis_export_go 1.11.5 github.com/Han-Ya-Jun/news_watch_notice</span><br><span class="line">Setting environment variables from repository settings</span><br><span class="line">$ export DOCKER_PASSWORD=[secure]</span><br><span class="line">$ export DOCKER_USERNAME=[secure]</span><br><span class="line">$ export GOBIN=$GOPATH/src/bin</span><br><span class="line">6.93s$ travis_setup_go</span><br><span class="line">go version go1.11.5 linux/amd64</span><br><span class="line">$ export GOPATH=&quot;/home/travis/gopath&quot;</span><br><span class="line">$ export PATH=&quot;/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.11.5.linux.amd64/bin:/home/travis/bin:/home/travis/bin:/home/travis/.local/bin:/opt/pyenv/shims:/home/travis/.phpenv/shims:/home/travis/perl5/perlbrew/bin:/home/travis/.nvm/versions/node/v8.9.1/bin:/home/travis/.kiex/elixirs/elixir-1.4.5/bin:/home/travis/.kiex/bin:/home/travis/.rvm/gems/ruby-2.4.1/bin:/home/travis/.rvm/gems/ruby-2.4.1@global/bin:/home/travis/.rvm/rubies/ruby-2.4.1/bin:/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.7.4.linux.amd64/bin:/usr/local/phantomjs/bin:/usr/local/phantomjs:/usr/local/neo4j-3.2.7/bin:/usr/local/maven-3.5.2/bin:/usr/local/cmake-3.9.2/bin:/usr/local/clang-5.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/travis/.rvm/bin:/home/travis/.phpenv/bin:/opt/pyenv/bin:/home/travis/.yarn/bin&quot;</span><br><span class="line">$ export GO111MODULE=&quot;auto&quot;</span><br><span class="line">$ gimme version</span><br><span class="line">v1.5.3</span><br><span class="line">$ go version</span><br><span class="line">go version go1.11.5 linux/amd64</span><br><span class="line">go.env</span><br><span class="line">$ go env</span><br><span class="line">GOARCH=&quot;amd64&quot;</span><br><span class="line">GOBIN=&quot;/home/travis/gopath/src/bin&quot;</span><br><span class="line">GOCACHE=&quot;/home/travis/.cache/go-build&quot;</span><br><span class="line">GOEXE=&quot;&quot;</span><br><span class="line">GOFLAGS=&quot;&quot;</span><br><span class="line">GOHOSTARCH=&quot;amd64&quot;</span><br><span class="line">GOHOSTOS=&quot;linux&quot;</span><br><span class="line">GOOS=&quot;linux&quot;</span><br><span class="line">GOPATH=&quot;/home/travis/gopath&quot;</span><br><span class="line">GOPROXY=&quot;&quot;</span><br><span class="line">GORACE=&quot;&quot;</span><br><span class="line">GOROOT=&quot;/home/travis/.gimme/versions/go1.11.5.linux.amd64&quot;</span><br><span class="line">GOTMPDIR=&quot;&quot;</span><br><span class="line">GOTOOLDIR=&quot;/home/travis/.gimme/versions/go1.11.5.linux.amd64/pkg/tool/linux_amd64&quot;</span><br><span class="line">GCCGO=&quot;gccgo&quot;</span><br><span class="line">CC=&quot;gcc&quot;</span><br><span class="line">CXX=&quot;g++&quot;</span><br><span class="line">CGO_ENABLED=&quot;1&quot;</span><br><span class="line">GOMOD=&quot;&quot;</span><br><span class="line">CGO_CFLAGS=&quot;-g -O2&quot;</span><br><span class="line">CGO_CPPFLAGS=&quot;&quot;</span><br><span class="line">CGO_CXXFLAGS=&quot;-g -O2&quot;</span><br><span class="line">CGO_FFLAGS=&quot;-g -O2&quot;</span><br><span class="line">CGO_LDFLAGS=&quot;-g -O2&quot;</span><br><span class="line">PKG_CONFIG=&quot;pkg-config&quot;</span><br><span class="line">GOGCCFLAGS=&quot;-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build083711362=/tmp/go-build -gno-record-gcc-switches&quot;</span><br><span class="line">install</span><br><span class="line">43.66s$ make image-dev</span><br><span class="line">mkdir -p dist</span><br><span class="line">git log | head -n 1 &gt; dist/news_watch_notice.sha</span><br><span class="line">docker run --rm -i -v `pwd`:/go/src/news_watch_notice \</span><br><span class="line">	  -w /go/src/news_watch_notice golang:1.11.5 \</span><br><span class="line">	  make news_watch_notice</span><br><span class="line">Unable to find image &apos;golang:1.11.5&apos; locally</span><br><span class="line">1.11.5: Pulling from library/golang</span><br><span class="line">22dbe790f715: Pulling fs layer</span><br><span class="line">0250231711a0: Pulling fs layer</span><br><span class="line">6fba9447437b: Pulling fs layer</span><br><span class="line">c2b4d327b352: Pulling fs layer</span><br><span class="line">619f4932b7ea: Pulling fs layer</span><br><span class="line">e2fd6cbd3c6f: Pulling fs layer</span><br><span class="line">1d96446d2b20: Pulling fs layer</span><br><span class="line">c2b4d327b352: Waiting</span><br><span class="line">e2fd6cbd3c6f: Waiting</span><br><span class="line">1d96446d2b20: Waiting</span><br><span class="line">619f4932b7ea: Waiting</span><br><span class="line">6fba9447437b: Verifying Checksum</span><br><span class="line">6fba9447437b: Download complete</span><br><span class="line">0250231711a0: Download complete</span><br><span class="line">22dbe790f715: Verifying Checksum</span><br><span class="line">22dbe790f715: Download complete</span><br><span class="line">c2b4d327b352: Verifying Checksum</span><br><span class="line">c2b4d327b352: Download complete</span><br><span class="line">619f4932b7ea: Verifying Checksum</span><br><span class="line">619f4932b7ea: Download complete</span><br><span class="line">1d96446d2b20: Verifying Checksum</span><br><span class="line">1d96446d2b20: Download complete</span><br><span class="line">e2fd6cbd3c6f: Verifying Checksum</span><br><span class="line">e2fd6cbd3c6f: Download complete</span><br><span class="line">22dbe790f715: Pull complete</span><br><span class="line">0250231711a0: Pull complete</span><br><span class="line">6fba9447437b: Pull complete</span><br><span class="line">c2b4d327b352: Pull complete</span><br><span class="line">619f4932b7ea: Pull complete</span><br><span class="line">e2fd6cbd3c6f: Pull complete</span><br><span class="line">1d96446d2b20: Pull complete</span><br><span class="line">Digest: sha256:342872745847966ab630e9cc5b6980ed3fe7f4e3ea44b10efac995575730c9b8</span><br><span class="line">Status: Downloaded newer image for golang:1.11.5</span><br><span class="line">CGO_ENABLED=0 go build -o dist/news_watch_notice news_watch_notice/cmd</span><br><span class="line">cd dist &amp;&amp; cp ../Dockerfile ./ &amp;&amp; \</span><br><span class="line">	docker build -t [secure]/news_watch_notice:latest .</span><br><span class="line">Sending build context to Docker daemon  14.78MB</span><br><span class="line">Step 1/6 : FROM alpine:3.6</span><br><span class="line">3.6: Pulling from library/alpine</span><br><span class="line">5a3ea8efae5d: Pulling fs layer</span><br><span class="line">5a3ea8efae5d: Verifying Checksum</span><br><span class="line">5a3ea8efae5d: Download complete</span><br><span class="line">5a3ea8efae5d: Pull complete</span><br><span class="line">Digest: sha256:ee0c0e7b6b20b175f5ffb1bbd48b41d94891b0b1074f2721acb008aafdf25417</span><br><span class="line">Status: Downloaded newer image for alpine:3.6</span><br><span class="line"> ---&gt; 43773d1dba76</span><br><span class="line">Step 2/6 : MAINTAINER [secure]0123@gmail.com</span><br><span class="line"> ---&gt; Running in 1f4d4d0db1cb</span><br><span class="line"> ---&gt; 0eadcccd5d22</span><br><span class="line">Removing intermediate container 1f4d4d0db1cb</span><br><span class="line">Step 3/6 : RUN apk update &amp;&amp; apk add curl bash tree tzdata     &amp;&amp; cp -r -f /usr/share/zoneinfo/Hongkong /etc/localtime</span><br><span class="line"> ---&gt; Running in 7f859dd06afc</span><br><span class="line">fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz</span><br><span class="line">fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz</span><br><span class="line">v3.6.5-39-gbdcdc921e8 [http://dl-cdn.alpinelinux.org/alpine/v3.6/main]</span><br><span class="line">v3.6.5-34-gf0ba0b43d5 [http://dl-cdn.alpinelinux.org/alpine/v3.6/community]</span><br><span class="line">OK: 8442 distinct packages available</span><br><span class="line">(1/11) Installing ncurses-terminfo-base (6.0_p20171125-r1)</span><br><span class="line">(2/11) Installing ncurses-terminfo (6.0_p20171125-r1)</span><br><span class="line">(3/11) Installing ncurses-libs (6.0_p20171125-r1)</span><br><span class="line">(4/11) Installing readline (6.3.008-r5)</span><br><span class="line">(5/11) Installing bash (4.3.48-r1)</span><br><span class="line">Executing bash-4.3.48-r1.post-install</span><br><span class="line">(6/11) Installing ca-certificates (20161130-r2)</span><br><span class="line">(7/11) Installing libssh2 (1.8.2-r0)</span><br><span class="line">(8/11) Installing libcurl (7.61.1-r2)</span><br><span class="line">(9/11) Installing curl (7.61.1-r2)</span><br><span class="line">(10/11) Installing tree (1.7.0-r0)</span><br><span class="line">(11/11) Installing tzdata (2019a-r0)</span><br><span class="line">Executing busybox-1.26.2-r11.trigger</span><br><span class="line">Executing ca-certificates-20161130-r2.trigger</span><br><span class="line">OK: 17 MiB in 24 packages</span><br><span class="line"> ---&gt; f923b8dbfbf2</span><br><span class="line">Removing intermediate container 7f859dd06afc</span><br><span class="line">Step 4/6 : ADD news_watch_notice /usr/bin/</span><br><span class="line"> ---&gt; a855f5307179</span><br><span class="line">Step 5/6 : ADD news_watch_notice.sha /usr/bin/</span><br><span class="line"> ---&gt; 9014ba35ce0f</span><br><span class="line">Step 6/6 : CMD news_watch_notice</span><br><span class="line"> ---&gt; Running in 109449b18721</span><br><span class="line"> ---&gt; acb6623feb46</span><br><span class="line">Removing intermediate container 109449b18721</span><br><span class="line">Successfully built acb6623feb46</span><br><span class="line">Successfully tagged [secure]/news_watch_notice:latest</span><br><span class="line">0.49s$ echo &quot;$DOCKER_PASSWORD&quot; | docker login -u &quot;$DOCKER_USERNAME&quot; --password-stdin</span><br><span class="line">Login Succeeded</span><br><span class="line">The command &quot;echo &quot;$DOCKER_PASSWORD&quot; | docker login -u &quot;$DOCKER_USERNAME&quot; --password-stdin&quot; exited with 0.</span><br><span class="line">5.21s$ make push-dev</span><br><span class="line">docker push [secure]/news_watch_notice:latest</span><br><span class="line">The push refers to a repository [docker.io/[secure]/news_watch_notice]</span><br><span class="line">c0546ad83870: Preparing</span><br><span class="line">869b27ab7e53: Preparing</span><br><span class="line">47b50a8202a0: Preparing</span><br><span class="line">721384ec99e5: Preparing</span><br><span class="line">721384ec99e5: Layer already exists</span><br><span class="line">c0546ad83870: Pushed</span><br><span class="line">47b50a8202a0: Pushed</span><br><span class="line">869b27ab7e53: Pushed</span><br><span class="line">latest: digest: sha256:74a706f3f8b5b2ead4a7722ca72d8f1eaa450801847662402e4e3e34f4d73158 size: 1157</span><br><span class="line">The command &quot;make push-dev&quot; exited with 0.</span><br></pre></td></tr></table></figure>
<h4 id="成功将项目打包成image并推送到docker-hub上">成功将项目打包成image并推送到docker hub上</h4>
<p><img src="http://cdn.hanyajun.com/20190516_004839_docker_hub.png" alt=""></p>

    <div id="aplayer-vlnMUpWk" class="aplayer aplayer-tag-marker meting-tag-marker" data-id="0028U15R4cIDQZ" data-server="tencent" data-type="song" data-mode="circulation" data-autoplay="false" data-mutex="false" data-listmaxheight="340px" data-preload="none" data-theme="#ad7a86"></div>
<p><br><br><br></p>
<div><h2 id="推荐文章">推荐文章<span style="font-size:0.45em; color:gray"></span></h2><ul><li><a href="https://hanyajun.com/devops/travis-ci/">如何使用travis-ci自动化构建部署GitHub Pages（gitbook）</a></li><li><a href="https://hanyajun.com/devops/code_pipeline_devops/">go程序基于阿里云CodePipeline的一次devops实践</a></li><li><a href="https://hanyajun.com/devops/gitbook_coding_ci/">基于Travis CI实现 Gitbook在 Github 和 Coding 的同步部署</a></li></ul></div>
                

                <hr>
                <!-- Pager -->
                <ul class="pager">
                    
                        <li class="previous">
                            <a href="/devops/gitbook_coding_ci/" data-toggle="tooltip" data-placement="top" title="基于Travis CI实现 Gitbook在 Github 和 Coding 的同步部署">&larr; Previous Post</a>
                        </li>
                    
                    
                        <li class="next">
                            <a href="/tools/windows_tree_skill/" data-toggle="tooltip" data-placement="top" title="windows上如何使用tree生成目录树">Next Post &rarr;</a>
                        </li>
                    
                </ul>

                <br>

                <!--打赏-->
                
                    <div class="reward">
                        <div class="reward-button">赏 <span class="reward-code"> 
                            <span class="alipay-code"> <img class="alipay-img" src="http://cdn.hanyajun.com/alipay.jpg"><b>支付宝打赏</b></span> 
                            <span class="wechat-code"> <img class="wechat-img" src="http://cdn.hanyajun.com/wepay.png"><b>微信打赏</b> </span>
                            </span></div>
                        <p class="reward-notice">坚持原创技术分享，您的支持将鼓励我继续创作！</p>
                    </div>
                
                <!--打赏-->

                <br>
                <!--分享-->
                
                    <div class="social-share"  data-wechat-qrcode-helper="" align="center"></div>
                    <!--  css & js -->
                    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css">
                    <script src="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script>
                
                <!--分享-->
                <br>                       
                
                <!-- require APlayer -->
                

                <!-- duoshuo Share start -->
                
                <!-- 多说 Share end-->

                <!-- 多说评论框 start -->
                
                <!-- 多说评论框 end -->

                <!-- disqus comment start -->
                
                <!-- disqus comment end -->

                
                    <!-- disqus 评论框 start -->
                    <div class="comment">
                        <div id="lv-container" data-id="city" data-uid="MTAyMC80MzgyNi8yMDM2MQ"></div>
                    </div>
                    <!-- disqus 评论框 end -->
                

            </div>
            
            <!-- Tabe of Content -->
            <!-- Table of Contents -->

  
    <style>
      span.toc-nav-number{
        display: none
      }
    </style>
  
    
      <aside id="sidebar">
        <div id="toc" class="toc-article">
        <strong class="toc-title">Contents</strong>
        
          <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#介绍"><span class="toc-nav-number">1.</span> <span class="toc-nav-text">&#x4ECB;&#x7ECD;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#项目"><span class="toc-nav-number">2.</span> <span class="toc-nav-text">&#x9879;&#x76EE;</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#项目目录"><span class="toc-nav-number">2.1.</span> <span class="toc-nav-text">&#x9879;&#x76EE;&#x76EE;&#x5F55;</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#dockerfile"><span class="toc-nav-number">2.2.</span> <span class="toc-nav-text">Dockerfile</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#makefile"><span class="toc-nav-number">2.3.</span> <span class="toc-nav-text">makefile</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#travisyml"><span class="toc-nav-number">2.4.</span> <span class="toc-nav-text">.travis.yml</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#travis的配置httpstravis-ciorg"><span class="toc-nav-number">3.</span> <span class="toc-nav-text">travis&#x7684;&#x914D;&#x7F6E;(<a href="https://travis-ci.org" target="_blank" rel="noopener">https://travis-ci.org</a>)</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#打开项目ci开关"><span class="toc-nav-number">3.1.</span> <span class="toc-nav-text">&#x6253;&#x5F00;&#x9879;&#x76EE;ci&#x5F00;&#x5173;</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#设置docker-hub的用户和密码环境变量push需要登录认证"><span class="toc-nav-number">3.2.</span> <span class="toc-nav-text">&#x8BBE;&#x7F6E;docker hub&#x7684;&#x7528;&#x6237;&#x548C;&#x5BC6;&#x7801;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF08;push&#x9700;&#x8981;&#x767B;&#x5F55;&#x8BA4;&#x8BC1;&#xFF09;</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#提交项目代码触发ci"><span class="toc-nav-number">4.</span> <span class="toc-nav-text">&#x63D0;&#x4EA4;&#x9879;&#x76EE;&#x4EE3;&#x7801;&#x89E6;&#x53D1;ci</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#部分ci日志"><span class="toc-nav-number">4.1.</span> <span class="toc-nav-text">&#x90E8;&#x5206;ci&#x65E5;&#x5FD7;</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#成功将项目打包成image并推送到docker-hub上"><span class="toc-nav-number">4.2.</span> <span class="toc-nav-text">&#x6210;&#x529F;&#x5C06;&#x9879;&#x76EE;&#x6253;&#x5305;&#x6210;image&#x5E76;&#x63A8;&#x9001;&#x5230;docker hub&#x4E0A;</span></a></li></ol></li></ol></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#推荐文章"><span class="toc-nav-number"></span> <span class="toc-nav-text">&#x63A8;&#x8350;&#x6587;&#x7AE0;<span style="font-size:0.45em; color:gray"></span></span></a>
        
        </div>
      </aside>
    

                
            <!-- Sidebar Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                <!-- Featured Tags -->
                
                <section>
                    <!-- no hr -->
                    <h5><a href="/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                       
                          <a class="tag" href="/tags/#devops" title="devops">devops</a>
                        
                    </div>
                </section>
                

                <!-- Friends Blog -->
                
                <hr>
                <h5>FRIENDS</h5>
                <ul class="list-inline">

                    
                        <li><a href="https://blog.csdn.net/hanyajun0123" target="_blank">CSDN Blog 韩亚军</a></li>
                    
                        <li><a href="https://hanyajun.com/golang-notes" target="_blank">golang学习笔记</a></li>
                    
                        <li><a href="https://hanyajun.com/coding_basis_review" target="_blank">编程基础复盘笔记</a></li>
                    
                        <li><a href="https://hanyajun.com/coding-life" target="_blank">程序人生</a></li>
                    
                        <li><a href="http://blog.didispace.com/" target="_blank">程序猿DD</a></li>
                    
                </ul>
                
            </div>
        </div>
    </div>
</article>






    <!-- 来必力City版公共JS代码 start (一个网页只需插入一次) -->
    <script type="text/javascript">
       (function(d, s) {
           var j, e = d.getElementsByTagName(s)[0];
    
           if (typeof LivereTower === 'function') { return; }
    
           j = d.createElement(s);
           j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
           j.async = true;
    
           e.parentNode.insertBefore(j, e);
       })(document, 'script');
    </script>
    <noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
    <!-- 来必力City版 公共JS代码 end -->



<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>
<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
<script>
    async("https://cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){
        anchors.options = {
          visible: 'hover',
          placement: 'left',
          icon: 'ℬ'
        };
        anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
    })
</script>
<style>
    /* place left on bigger screen */
    @media all and (min-width: 800px) {
        .anchorjs-link{
            position: absolute;
            left: -0.75em;
            font-size: 1.1em;
            margin-top : -0.1em;
        }
    }
</style>


<!-- 复制添加版权申明-->
<script>
    /**/
    function setClipboardText(event){
        event.preventDefault();//阻止元素发生默认的行为（例如，当点击提交按钮时阻止对表单的提交）。
        var node = document.createElement('div');
        //对documentfragment不熟，不知道怎么获取里面的内容，用了一个比较笨的方式
        node.appendChild(window.getSelection().getRangeAt(0).cloneContents());
        //getRangeAt(0)返回对基于零的数字索引与传递参数匹配的选择对象中的范围的引用。对于连续选择，参数应为零。
        var htmlData = '<div>'
            + node.innerHTML
            + '<br /><br />著作权归作者所有。<br />'
            + '商业转载请联系作者获得授权，非商业转载请注明出处。<br />'
            + '作者：hanyajun <br />链接：'
            + location.href
            + '<br />来源：hanyajun.com<br /><br />'
            + '</div>';
        var textData = window.getSelection().getRangeAt(0)
            + '\n\n著作权归作者所有。\n'
            + '商业转载请联系作者获得授权，非商业转载请注明出处。\n'
            + '作者：hanyajun\n'
            + '链接：'
            + location.href
            + '来源：hanyajun.com\n\n';
        if(event.clipboardData){
            event.clipboardData.setData("text/html", htmlData);
            //setData(剪贴板格式, 数据) 给剪贴板赋予指定格式的数据。返回 true 表示操作成功。
            event.clipboardData.setData("text/plain",textData);
        }
        else if(window.clipboardData){ //window.clipboardData的作用是在页面上将需要的东西复制到剪贴板上，提供了对于预定义的剪贴板格式的访问，以便在编辑操作中使用。
            return window.clipboardData.setData("text", textData);
        }
    };
 
    document.addEventListener('copy',function(e){
        setClipboardText(e);
    });
</script>

<!-- chrome Firefox 中文锚点定位失效-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<!-- smooth scroll behavior polyfill  -->
<script type="text/javascript" src="/js/smoothscroll.js"></script>
<script>
        $('#toc').on('click','a',function(a){
            // var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
            // console.log(window.navigator.userAgent,isChrome)
                // if(isChrome) {
                    // console.log(a.currentTarget.outerHTML);
                    // console.log($(a.currentTarget).attr("href"));
                    //跳转到指定锚点
                    // document.getElementById(a.target.innerText.toLowerCase()).scrollIntoView(true);
                    document.getElementById($(a.currentTarget).attr("href").replace("#","")).scrollIntoView({behavior: 'smooth' });
                // }
        })  
</script>




<!-- disqus embedded js code start (one page only need to embed once) -->
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<!-- disqus embedded js code start end -->


    <!-- Footer -->
    <!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                
                    <li>
                        <a href="/atom.xml" title="RSS">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-rss fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                
                
                

                

                

                
                    <li>
                        <a target="_blank"  href="https://github.com/Han-Ya-Jun" title="github">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://blog.csdn.net/hanyajun0123" title="CSDN">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">C</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://yq.aliyun.com/u/hanyajun" title="云栖社区">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">云</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://juejin.im/user/5abc76cf6fb9a028bf05642e" title="掘金">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">掘</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href=" mailto:hanyajun0123@163.com" title="mail">
                            <span class="fa-stack fa-lg">
                               <i class="fa fa-circle fa-stack-2x"></i>
                               <i class="fa fa-envelope-o fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                </ul>
                <p class="copyright text-muted">
                    Copyright &copy; 韩亚军 2019 
                    <br>
                    Theme by <a href="http://www.huweihuang.com">胡伟煌</a> 
                    <span style="display: inline-block; margin: 0 5px;">
                        <i class="fa fa-heart"></i>
                    </span> 
                    re-Ported by <a href="http://www.hanyajun.com">韩亚军</a> | 
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="91px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=Han-Ya-Jun&repo=hexo-theme-hanyajun&type=star&count=true" >
                    </iframe>
                    <br />
                    <!--总访问量统计-->
                    
                        <span>
                        <a target="_blank" href="http://www.beianbeian.com/beianxinxi/7625ff811d2421a06b38a23c0a085037.html"><img src="/img/upload/beian.png">粤ICP备17133239号-1</a>
                        </span>
                        <span id="busuanzi_container_site_pv" style="margin-left: 3px;">
                            总访问量<span id="busuanzi_value_site_pv"></span>次
                        </span>
                    
                    <!--总访问量统计-->
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="/js/hux-blog.min.js"></script>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/    
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->


<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if($('#tag_cloud').length !== 0){
        async("https://hanyajun.com/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->


<script>
    // dynamic User by Hux
    var _gaId = 'UA-138985430-1';
    var _gaDomain = 'hanyajun.com';

    // Originial
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', _gaId, _gaDomain);
    ga('send', 'pageview');
</script>




<!-- Baidu Tongji -->

<script>
    // dynamic User by Hux
    var _baId = 'a79d548adc1c9b6a3d8b8ba1e8d0620c';

    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>






	<a id="rocket" href="#top" class=""></a>
	<script type="text/javascript" src="/js/totop.js?v=1.0.0" async=""></script>
    <script type="text/javascript" src="/js/toc.js?v=1.0.0" async=""></script>
<!-- Image to hack wechat -->
<img src="https://hanyajun.com/img/icon_wechat.png" width="0" height="0" />
<!-- Migrate from head to bottom, no longer block render and still work -->

</body>

</html>
